import { getToken, getUserinfo, setToken, setUserinfo } from "@/utils/auth";
import { menu } from "@/api/login";

const state = {
  token: getToken(),
  userInfo: getUserinfo(),
};

const mutations = {
  setToken(state, value) {
    console.log(value);
    state.token = value;
    setToken(value);
  },
  setUserInfo(state, value) {
    state.userInfo = value;
    setUserinfo(value);
  },
};

const actions = {
  // async getMenuList() {
  //   const aaa = await menu();
  //   console.log(aaa);
  // },
};

export default {
  namespaced: true,
  state,
  mutations,
  actions,
};
